package com.jt.friendsmanagement;

import android.content.Context;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;

public class FriendLab {
    private static FriendLab sFriendLab;
    private List<Friend> mFriends;

    public static FriendLab get(Context context) {
        if (sFriendLab == null) {
            sFriendLab = new FriendLab(context);
        }
        return sFriendLab;
    }

    private FriendLab(Context context) {
        mFriends = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            Friend friend = new Friend();
            friend.setName("Friend #" + i);

            mFriends.add(friend);
        }
    }

    public List<Friend> getFriends() {
        return mFriends;
    }

    public Friend getFriend(UUID uuid) {
        for (Friend friend : mFriends) {
            if (friend.getId().equals(uuid)) {
                return friend;
            }
        }
        return null;
    }

    public void addFriend(Friend friend) {
        mFriends.add(friend);
    }
}
